import pytest
from common.mysql_tools import connect, execute, disconnect
from selenium import webdriver
from time import sleep
from conf.env import url
@pytest.fixture(scope="session")
def database_clean():
    a = connect()
    # 常见错误 port 整数  pwd 字符串   charset utf8 不是 utf-8
    print(execute(a, "select * from sys_user "))
    # print(execute(a, "insert into xqdsys_user (account,password)values('test9529',MD5('123456')) "))
    # print(execute(a, "select * from xqdsys_user "))
    disconnect(a)
    print('执行数据库清理')

@pytest.fixture()
def get_driver():
    driver = webdriver.Chrome()
    driver.maximize_window()
    sleep(2)
    driver.get(url)
    yield driver
    #后置
    driver.close()
    driver.quit()